package com.naiterui.ehp.bs.doctor.dao.impl;

import com.naiterui.ehp.bp.domain.DeviceToken;
import com.naiterui.ehp.bs.doctor.dao.IDeviceTokenDao;
import com.naiterui.ehp.bs.doctor.repository.IDeviceTokenRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class AdDeviceTokenDaoImpl  implements IDeviceTokenDao {

    @Autowired
    private IDeviceTokenRepository deviceTokenRepository;

    @Override
    public DeviceToken findDeviceTokenByToken(String token) {
        List<DeviceToken> list = deviceTokenRepository.findByDeviceToken(token);
        if (list == null || list.size() <= 0) {
            return null;
        }
        return list.get(0);
    }

}
